package com.situ.mall.order.controller;


import com.situ.mall.common.util.Result;
import com.situ.mall.order.service.IOrderItemService;
import com.situ.mall.pojo.VO.EChartsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 订单项信息 前端控制器
 * </p>
 *
 * @author CKX
 * @since 2024-10-16
 */
@RestController
@RequestMapping("/order/orderItem")
public class OrderItemController {

    @Autowired
    private IOrderItemService orderItemService;

    @GetMapping("/selectByOrderNo/{id}")
    public Result<Map<String, Object>> selectByOrderNo(@PathVariable("id") Integer id) {
        Map<String, Object> map = orderItemService.selectByOrderNo(id);
        return Result.ok(map);
    }

    @GetMapping("/selectEarning")
    public Result<List<EChartsVO>> selectEarning() {
        List<EChartsVO> list = orderItemService.selectEarning();
        return Result.ok(list);
    }
}

